Next:
Install GCC
, Previous:
fork [system call]
, Up:
Index
getpid & getppid [system call]
함수원형
#include
<sys.types.h>
#include
<unistd.h>
pid_t
getpid
(
void
)
;
pid_t
getppid
(
void
)
;
getpid.c
#include
<sys/types.h>
#include
<unistd.h>
#include
<stdio.h>
int
main
(
void
)
{
printf
(
"
pid=
%d\n
"
,
getpid
(
))
;
printf
(
"
ppid=
%d\n
"
,
getppid
(
))
;
}
celina@ubuntuserver
:
~/celina/test
$ ./getpid
pid=1591
ppid=1477
위의 ppid는 bash의 pid